/*
*
* DModeGroup
*
* This class is meant to represent a group of drawing modes
* Why do drawing modes need to be grouped? Only for the
* purposes of organizing the mode selector dialog (at this
* point, at least). 
*
* Note that to be used correctly, DModeGroups can only have
* dModeGroupChildren OR dMode populated; not both
*
*/
class DModeGroup{
  
  // -----------------------------------------------
  // attributes
  // -----------------------------------------------
  
  // note: two names needed to avoid ControlP5.MultiListButtons with the same name
  String name, displayName;
  ArrayList<DModeGroup> dmgChildren;
  DMode dMode;
  int index;
  
  // -----------------------------------------------
  // constructor
  // -----------------------------------------------
  DModeGroup(String na) {
  
    name = na;
    displayName = na;
    dmgChildren = new ArrayList<DModeGroup>();
    index = 0;
    
  } // constructor
  
  // -----------------------------------------------
  // constructor; this version overloaded; takes
  // drawing mode as argument
  // -----------------------------------------------
  DModeGroup(DMode dm, int ind) {
  
    dMode = dm;
    name = dMode.hashName;
    displayName = dMode.name;
    index = ind;
  
  } // constructor
  
  // -----------------------------------------------
  // addChild
  // adds child drawing mode group
  // -----------------------------------------------
  void addChild(DModeGroup dmg) {
    
    // write error message if 
    if(dMode == null) {
      dmgChildren.add(dmg);
    } else {
      println("Can't add DModeGroup: this class already has a dMode defined");
    }
    
  } // addChild
   
  
  
} // class
